//--
//--

WeDataDic = {};


CSUtils.WeData = function () {
}
CSUtils.WeData.prototype = {}

CSUtils.WeData.GetWeDataObj = function (typeId) {
    let weDataObj = WeDataDic[typeId.id]
    if (weDataObj == null) {
        cc.error("错误....获取WeData类型失败....." + typeId)
    }
    return weDataObj;
}

CSUtils.WeData.S_SerializableString = function (weDataObj) {

}
CSUtils.WeData.S_DeSerializationString = function (weDataStr, isArray) {
    const tag = "WeData.S_DeSerializationString";
    let _data = null;
    if (IsNullOrEmpty(weDataStr)) {
        return null;
    }
    weDataStr = weDataStr.replace('\r', '');
    weDataStr = weDataStr.replace('\n', '');
    let sssLine = weDataStr.split(CString.cSplit04);
    //cc.log("S_DeSerializationString..解析的行数____{0}", sssLine.Length);
    let sss0 = sssLine[0].split(CString.cSplit01);
    let type = parseInt(sss0[0].trim());

    if (type === EBaseType.e018_array) {
        let lenStr = sss0[1].trim();
        let len = parseInt(lenStr)
        let _arr = [len];
        for (let i = 0; i < len; i++) {
            let idStr = sss0[i + 2].trim();
            _arr[i] = parseInt(idStr);
        }
        _data = _arr;
    }
    //1.获取<<结构体对象列表>>
    let uintObjDic = {};
    let uintStringsDic = {};
    for (let i = 1; i < sssLine.length; i++) {
        let objFieldArr = sssLine[i].split(CString.cSplit01);
        if (objFieldArr.length < 2) {
            continue;
        }
        for (let i5 = 0; i5 < objFieldArr.length; i5++) {
            objFieldArr[i5] = objFieldArr[i5].split(CString.cSplit11)[0];
        }
        let typeId = CInt4.Get(objFieldArr[0]);
        let _instanceId = objFieldArr[1].trim();
        let instanceId = parseInt(_instanceId);
        let data = CSUtils.WeData.GetWeDataObj(typeId);
        if (data != null) {
            data.m_SerializableId = instanceId;
            uintObjDic[data.m_SerializableId] = data;
            uintStringsDic[data.m_SerializableId] = objFieldArr;
            if (_data == null) {
                _data = data;
            }
        }
    }
    let array4 = CMap.valueArr(uintObjDic)
    let uintObjDicLen = array4.length;
    for (let i = 0; i < array4.length; i++) {
        try {
            array4[i].S_DeSerializationString(uintStringsDic[array4[i].m_SerializableId], 2, uintObjDic);
        } catch (ex) {
            Log.Ex(tag, "错误." + i + "_" + uintObjDicLen, ex);
        }
    }
    for (let i = 0; i < array4.length; i++) {
        try {
            array4[i].S_DeSerialization();
        } catch (ex) {
            Log.Ex(tag, "错误." + i + "_" + uintObjDicLen, ex);
        }
    }
    if (type == EBaseType.e018_array) {
        isArray = true;
        let array0 = _data;
        let array = [array0.length];
        for (let i = 0; i < array0.length; i++) {
            array[i] = uintObjDic[array0[i]];
        }
        _data = array;
    } else {
        isArray = false;
    }
    return _data;
}